<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="ctx/ctx.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>安管人员听课</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="${ctx }/resources/js/jquery-3.1.1.min.js"></script>
  </head>
  
  
  <body>
  	<center>
  	<a href="${ctx }/xuanxiu" style="padding-right: 30px">选修</a>
  	<a href="${ctx }/bixiu" style="padding-right: 30px">必修</a>
  	<a href="${ctx }/bixiu" style="padding-right: 30px">八大员</a>
  	
  	</center>
  	<div style="height: 30px"></div>
  	
  	<center><h3>安管人员听课</h3></center>
    <form action="${ctx }/anGuan" name="lgoin" id="login" method="post">
    	<table align="center" border="0">
    		<tr height="40px">
    			<td align="right" width="120px;">用户名：</td>
    			<td><input type="text" name="txtUserName" id="name"></td>
    		</tr>
    		<tr>
    			<td align="right" width="120px;"> 密码：</td>
    			<td> <input type="password" name="txtPwd" value="888888"></td>
    		</tr>
    		<tr height="40px">
    			<td align="right" width="120px;">课程类型：</td>
    			<td>
    			<select id="flags">
    				<option value="0" selected="selected">网络初次培训</option>
    				<option value="1">安全生产知识培训</option>
    			</select> </td>
    		</tr>
    		<tr height="40px">
    			<td align="right" width="120px;">节数：</td>
    			<td><input type="text" name="numBegin" id="num1" value="1" size="5">—<input type="text" name="numEnd" id="num2" value="60" size="5">
    			</td>
    		</tr>
    		<tr height="50px">
    			<td colspan="2" align="center">
    				<span id="cotinue" style="display: none">
    					<input type="button" value="只听课" id="btn1" onclick="toLogin(1)">
    					<input type="button" value="听课并考试" id="btn2" onclick="toLogin(2)">
    					<input type="button" value="只考试" id="btn3" onclick="toLogin(3)">
    				</span>
    				<span id="first" >
    					<input type="button" value="一键听课" id="btn" onclick="toLogin(0)">
    				</span>
    				<input type="hidden" id="zyid" name="ZY">
    			</td>
    		</tr>
    	</table>
    </form>
    <script type="text/javascript">
    $(document).ready(function (){
    	var ctx = "${ctx}";
    	$("#flags").change(function(){
    		var vs = $("select option:selected").val();
        	if(vs==0){
        		$("#cotinue").hide();
        		$("#first").show();
        		$("#num2").val(60);
        		$("#login").attr("action", ctx + "/anGuan");
        	}
        	if(vs==1){
        		$("#cotinue").show();
        		$("#first").hide();
        		$("#num2").val(19);
        		$("#login").attr("action", ctx + "/anGuanContinue");
        	}
    	});
    });
    
    function toLogin(flag){
    	var num1 = document.getElementById("num1").value;
    	var num2 = document.getElementById("num2").value;
    	$("#zyid").val(flag);
    	if(parseInt(num2) < parseInt(num1)){
    		alert("听课结束课数不能小于开始课数!");
    		return ;
    	}
    	if($("#name").val()!=""){
    		document.getElementById('login').submit();
    	}else{
    		alert("请填写用户名");
    	}
    }
   	 
    </script>
  </body>
</html>
